package com.xxx.lease.common.mybatisplus;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.ibatis.reflection.MetaObject;

import java.util.Date;


/*
*   自定义的数据（日期）填充处理器
* */

public class MyMetaObjectHandler implements MetaObjectHandler {


/*
*   mybatisPlus检测到要执行insert添加的时候，自动执行以下的方法
* */


    @Override
    public void insertFill(MetaObject metaObject) {
        System.out.println(metaObject);
        this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
    }
}
